/*
 * XML.java
 *
 * Created on August 1, 2007, 12:59 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.atomojo.auth.service.db;

import java.net.URI;
import java.net.URL;
import org.atomojo.app.client.XMLRepresentationParser;
import org.atomojo.auth.service.app.AuthApplication;
import org.infoset.xml.Name;

/**
 *
 * @author alex
 */
public class XML
{
   
   public static URL authXSD;
   public static URI authNS = URI.create("http://www.atomojo.org/Vocabulary/Auth/2007/1/0");
   public static Name DATABASE_NAME = Name.create(authNS,"database");
   public static Name PERMISSIONS_NAME = Name.create(authNS,"permissions");
   public static Name PERMISSION_NAME = Name.create(authNS,"permission");
   public static Name REALMS_NAME = Name.create(authNS,"realms");
   public static Name REALM_NAME = Name.create(authNS,"realm");
   public static Name ROLES_NAME = Name.create(authNS,"roles");
   public static Name ROLE_NAME = Name.create(authNS,"role");
   public static Name GROUPS_NAME = Name.create(authNS,"groups");
   public static Name GROUP_NAME = Name.create(authNS,"group");
   public static Name USERS_NAME = Name.create(authNS,"users");
   public static Name USER_NAME = Name.create(authNS,"user");
   public static Name PASSWORD_NAME = Name.create(authNS,"password");
   public static Name NAME_NAME = Name.create(authNS,"name");
   public static Name EMAIL_NAME = Name.create(authNS,"email");
   static {
      authXSD = XML.class.getResource("auth.xsd");
      if (authXSD==null) {
         throw new RuntimeException("Cannot find auth.xsd relative to class path.");
      }
   }
   
   public static XMLRepresentationParser createParser() {
      XMLRepresentationParser parser = new XMLRepresentationParser();
      parser.addNamespaceLocation(authNS,authXSD);
      parser.setValidation(true);
      return parser;
   }
   
   /** Creates a new instance of XML */
   private XML()
   {
   }
   
}
